import {
    message,
} from 'antd';
import ProTable, {ActionType} from '@ant-design/pro-table';
import type {ProColumns} from '@ant-design/pro-table';
import {saveUploaInfo, uploadList} from "@/services/login";
import {useRef} from "react";

export type Earn = {
    date: string;
    note: string;
    amount: string;
};
const columns: ProColumns<Earn>[] = [
    {
        dataIndex: 'date',
        title: 'Date',
    },
    {
        dataIndex: 'note',
        title: 'Note',
    },
    {
        dataIndex: 'amount',
        title: 'Amount',
    }
];

export default () => {
    const tablea = useRef<ActionType>();

    return (
        <div>
            <ProTable<Earn>
                locale={{ emptyText:"No Data"}}
                bordered={true}
                actionRef={tablea}
                columns={columns}
                request={async (params: any) => {
                    const response = await uploadList({
                        page: {
                            currentPage: params.current,
                            pageSize: params.pageSize,
                        }
                    });

                    let {data: {list}} = response;
                    return {data: list, success: true};
                }}
                pagination={false}
                toolBarRender={false}
                search={false}
            />
        </div>

    );
};
